#ifndef _WHRESULTMANAGER_H
#define _WHRESULTMANAGER_H

/******************************************************************************
** @file	WHResultManager.h
** @author  Joel Chuca Condo
**
** @date	Agu 9, 2010
**
** @desc	This class holds all the WHResult possible objects. 
**			
**
******************************************************************************/

#include <map>

#include "WHResult.h"

/**
* Definition of WHRESULT type
*/
typedef long WHRESULT;

/**
* Definition of conditions to evaluate WHRESULT type
*/
#define WFAILED(hr) (((HWRESULT)(whr)) < 0)
#define WSUCCEEDED(hr) (((WHRESULT)(whr)) == 0)

/**
* Key constants for identify WHResult objects
*/
const wstring W_OK = L"W_OK";
const wstring W_FAILURE = L"W_FAILURE";
const wstring W_CON = L"W_CON";
const wstring W_DIR = L"W_DIR";
const wstring W_PROC = L"W_PROC";
const wstring W_SHR = L"W_SHR";
const wstring W_REG = L"W_REG";


/**
* Class constructor to create a new WMI conection
*/
class WHResultManager
{
private:
    /**
    * Default constructor that initializes all the WHResult possible objects.
    */
    WHResultManager();    

public:

    /*
	* Gets a single instace for this class
	* @return a single instace for this class
	*/
    static WHResultManager* getInstance();

    /*
	* Gets a value of WHRESULT type related to the key which is 
    * coming as a parameter.
    *
	* @return a value of WHRESULT type.
	*/
    WHRESULT getResult(wstring key);

    /*
	* Gets a text that describes the value of WHResult type
    *
	* @return a string.
	*/
    wstring getDescription(WHRESULT wr);

private:

    /*
	* Holds a sigle instance of this class
   	*/
    static WHResultManager* pinstance;

    /*
	* Holds a set of WHResult objects
   	*/
    std::map<wstring, WHResult> resMap;    
};



/*
WHRESULT getResult(wstring key)
{
    WHResultManager *rmap = WHResultManager::instance();
    return rmap->get(key);
}

wstring getDescription(WHRESULT wr)
{
    WHResultManager *rmap = WHResultManager::instance();
    return rmap->getDescription(wr);
}*/
#endif
